//  我的优惠券
//  CouponViewController.m
//  GoBigMarket
//
//  Created by 李真 on 16/8/20.
//  Copyright © 2016年 legend. All rights reserved.
//

#import "CouponViewController.h"
#import "CouponTableViewCell.h"
@interface CouponViewController ()
@property (nonatomic,strong)NSMutableArray *muArr;
@property (nonatomic,strong)UILabel *headerLabel;//头视图label

@end

@implementation CouponViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"我的优惠券";
    _muArr = [NSMutableArray array];
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, XNWindowWidth, 44)];
    
    if (!_headerLabel) {
        _headerLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 2, XNWindowWidth, 40)];
    }
    _headerLabel.text = @"我的优惠券";
    _headerLabel.textAlignment = NSTextAlignmentLeft;
    [view addSubview:_headerLabel];
    _tableView.tableHeaderView = view;
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    
}
#pragma mark - UITableViewDataSource
//使用分组来控制cell间距
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"logCell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"logCell"];
    }
    cell.textLabel.text = [NSString stringWithFormat:@"%@",indexPath];
    cell.textLabel.numberOfLines = 0;
    cell.contentView.backgroundColor = GDJRandomColor;
    return cell;
}

#pragma mark - UITableViewDelegate
//点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //退出当前页，并携带一定的信息
    [self.navigationController popViewControllerAnimated:YES];
}
//cell高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 150;
}
@end
